//
//  BenefitsViewController.m
//  ShouYi
//
//  Created by yurui on 16/2/18.
//  Copyright © 2016年 yurui. All rights reserved.
//

#import "BenefitsViewController.h"
#import "BenefitsTableViewCell.h"

#define kAllBtColor [UIColor colorWithRed:200 / 255.0 green:72 / 255.0 blue:59 / 255.0 alpha:1]
#define kCancelBtColor [UIColor colorWithRed:57 / 255.0 green:152 / 255.0 blue:198 / 255.0 alpha:1]

@interface BenefitsViewController ()<UITableViewDataSource,UITableViewDelegate,UITextFieldDelegate>
@property(nonatomic,strong) UIImageView *headerView;
@property(nonatomic,strong) UILabel *headerTitle;
@property(nonatomic,strong) UIImageView *qianImageview;
@property(nonatomic,strong) UILabel *shouYiLabel;
@property(nonatomic,strong) UILabel *moneyLabel;

@property(nonatomic,strong)UIView *fenHongView;
@property(nonatomic,strong) UILabel *firLabel;
@property(nonatomic,strong) UILabel *firNum;
@property(nonatomic,strong) UILabel *senLabel;
@property(nonatomic,strong) UILabel *senNum;
@property(nonatomic,strong) UILabel *thirdLabel;
@property(nonatomic,strong) UILabel *thirdNum;

@property(nonatomic,strong) UIView *tiXianView;
@property(nonatomic,strong) UILabel *leiJiSY;
@property(nonatomic,strong) UILabel *tiXianSY;
@property(nonatomic,strong) UILabel *leiJiMoney;
@property(nonatomic,strong) UILabel *tiXianMoney;
@property(nonatomic,strong) UIButton *tiXianBt;

@property(nonatomic,strong) UIView *readView;
@property(nonatomic,strong) UILabel *todayRead;
@property(nonatomic,strong) UILabel *todayNum;
@property(nonatomic,strong) UILabel *leiJiRead;
@property(nonatomic,strong) UILabel *leiJiNumber;

//点击提现 弹出框
@property(nonatomic,strong) UIView *bigView;
@property(nonatomic,strong) UIView *TXView;
@property(nonatomic,strong) UITextField *textField;
@property(nonatomic,strong) UITableView *tableView;


@property(nonatomic,strong) AppDelegate *delegate;

@property(nonatomic,strong) UIImageView *backImage;
@property(nonatomic,strong) UIButton *loginBt;
@property(nonatomic,strong) UIButton *registBt;
@end

@implementation BenefitsViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navigationController.navigationBarHidden = YES;
    self.view.backgroundColor = [UIColor colorWithRed:248 / 255.0 green:247 / 255.0 blue:247 / 255.0 alpha:1];
    self.delegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
    if (_delegate.isLogin == 0 && _delegate.isThirdLogin == 0) {
        NSLog(@"没有登陆");
        self.backImage = [[UIImageView alloc]initWithFrame:[UIScreen mainScreen].bounds];
        self.backImage.image = [UIImage imageNamed:@"icon_login.png"];
        self.backImage.userInteractionEnabled = YES;
        [self.view addSubview:_backImage];
        
        self.loginBt = [UIButton buttonWithType:UIButtonTypeCustom];
        self.loginBt.frame = CGRectMake(kWidth / 2 - 50, kHeight / 2 , 100, 35);
        [self.loginBt setTitle:@"登  录" forState:UIControlStateNormal];
        [self.loginBt setTitleColor:[UIColor colorWithRed:189 / 255.0 green:46 / 255.0 blue:53 / 255.0 alpha:1] forState:UIControlStateNormal];
        self.loginBt.layer.cornerRadius = 5;
        self.loginBt.layer.borderWidth = 1;
        self.loginBt.layer.borderColor = [UIColor colorWithRed:189 / 255.0 green:46 / 255.0 blue:53 / 255.0 alpha:1].CGColor;
        [self.backImage addSubview:_loginBt];
        
        self.registBt = [UIButton buttonWithType:UIButtonTypeCustom];
        self.registBt.frame = CGRectMake(kWidth / 2 - 50, kHeight / 2 + 55, 100, 35);
        [self.registBt setTitleColor:[UIColor colorWithRed:189 / 255.0 green:46 / 255.0 blue:53 / 255.0 alpha:1] forState:UIControlStateNormal];
        self.registBt.layer.cornerRadius = 5;
        self.registBt.layer.borderWidth = 1;
        self.registBt.layer.borderColor = [UIColor colorWithRed:189 / 255.0 green:46 / 255.0 blue:53 / 255.0 alpha:1].CGColor;
        self.registBt.layer.cornerRadius = 5;
        [self.registBt setTitle:@"注  册" forState:UIControlStateNormal];
        [self.backImage addSubview:_registBt];
        
        
    }else{
        // 监听键盘高度
        [self notificationKeyboardHeight];
        [self configerTableView];
        [self addSubViews];
        
        NSString *uuid = [kUserDefault objectForKey:@"CFUUID"];
        NSDictionary *params = @{@"uuid":uuid};
        [LORequestManger POST:@"http://wx1.01zg.com/plugins/app/chaozan/main.php?action=shouyi_index&sid=2216&uuid=" params:params success:^(id response) {
            NSLog(@"RESPONSE = %@",response);
            NSDictionary *dic = response[@"infoshow"];
            NSLog(@"dic = %@",dic);
            self.moneyLabel.text = dic[@"shouyi_today"];
            self.firNum.text = dic[@"yongjin1"];
            self.senNum.text = dic[@"yongjin2"];
            self.thirdNum.text = dic[@"yongjin3"];
            self.leiJiMoney.text = dic[@"shouyi_all"];
            self.tiXianMoney.text = dic[@"tixian1"];
            self.todayNum.text = dic[@"readnum_today"];
            self.leiJiNumber.text = dic[@"readnum_all"];
        } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
            NSLog(@"error = %@",error);
        }];
    }
}
- (void)viewWillAppear:(BOOL)animated{
    self.navigationController.navigationBarHidden = YES;
}
- (void)configerTableView{
    self.tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, -20, kWidth, kHeight ) style:UITableViewStylePlain];
    self.tableView.backgroundColor = [UIColor whiteColor];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    [self.tableView registerClass:[BenefitsTableViewCell class] forCellReuseIdentifier:@"cell"];
    self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
    [self.view addSubview:_tableView];
}

- (void) addSubViews{
    UIView *View = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kWidth, 390)];
    View.backgroundColor = kViewBackColor;
    self.tableView.tableHeaderView = View;
    // 头部试图
    self.headerView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0,kWidth , 190)];
    self.headerView.backgroundColor = kBackGroundColor;
    [View addSubview:_headerView];
    //头部标题
    self.headerTitle = [[UILabel alloc]initWithFrame:CGRectMake(0, 10, kWidth, 70)];
    self.headerTitle.text = @"我的账户";
    self.headerTitle.textColor = [UIColor whiteColor];
    self.headerTitle.font = [UIFont systemFontOfSize:18 ];
    self.headerTitle.textAlignment = NSTextAlignmentCenter;
    [self.headerView addSubview:_headerTitle];
    // 💰 符号
    self.qianImageview = [[UIImageView alloc]initWithFrame:CGRectMake(20, 90, 17, 17)];
    self.qianImageview.image = [UIImage imageNamed:@"icon_qian.png"];
    [self.headerView addSubview:_qianImageview];
    // 收益
    self.shouYiLabel = [[UILabel alloc]initWithFrame:CGRectMake(38, 90, 100, 17)];
    self.shouYiLabel.text = @"今日收益(元)";
    self.shouYiLabel.font = [UIFont systemFontOfSize:15];
    self.shouYiLabel.textColor = [UIColor whiteColor];
    [self.headerView addSubview:_shouYiLabel];
    // 收益金额
    self.moneyLabel = [[UILabel alloc]initWithFrame:CGRectMake(20, 115, 200, 70)];
    self.moneyLabel.textColor = [UIColor whiteColor];
    self.moneyLabel.font = [UIFont systemFontOfSize:60];
    //self.moneyLabel.text = @"0.00";
    [self.headerView addSubview:_moneyLabel];
    
    // 分红 View
    self.fenHongView = [[UIView alloc]initWithFrame:CGRectMake(0, 190, kWidth, 54)];
    self.fenHongView.backgroundColor = [UIColor whiteColor];
    [View addSubview:_fenHongView];
    // 一级分红
    self.firLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 5, kWidth / 3, 20)];
    self.firLabel.text = @"一级分红";
    self.firLabel.textAlignment = NSTextAlignmentCenter;
    self.firLabel.font = [UIFont systemFontOfSize:14];
    self.firLabel.textColor = [UIColor grayColor];
    [self.fenHongView addSubview:_firLabel];
    // 一级分红 金额
    self.firNum = [[UILabel alloc]initWithFrame:CGRectMake(0, 28, kWidth / 3, 20)];
    // self.firNum.text = @"￥0";
    self.firNum.textColor = [UIColor colorWithRed:229 / 255.0 green:89 /255.0 blue:89 / 255.0 alpha:1];
    self.firNum.textAlignment = NSTextAlignmentCenter;
    self.firNum.font = [UIFont systemFontOfSize:17];
    [self.fenHongView addSubview:_firNum];
    
    UIView *fenGe = [[UIView alloc]initWithFrame:CGRectMake(kWidth / 3 - 0.5, 10, 1, 35)];
    fenGe.backgroundColor = kViewBackColor;
    [self.fenHongView addSubview:fenGe];
    
    // 二级分红
    self.senLabel = [[UILabel alloc]initWithFrame:CGRectMake(kWidth / 3, 5, kWidth / 3, 20)];
    self.senLabel.text = @"二级分红";
    self.senLabel.textAlignment = NSTextAlignmentCenter;
    self.senLabel.font = [UIFont systemFontOfSize:14];
    self.senLabel.textColor = [UIColor grayColor];
    [self.fenHongView addSubview:_senLabel];
    // 二级分红 金额
    self.senNum = [[UILabel alloc]initWithFrame:CGRectMake(kWidth / 3, 28, kWidth / 3, 20)];
    // self.senNum.text = @"￥0";
    self.senNum.textColor = [UIColor colorWithRed:250 / 255.0 green:214 /255.0 blue:42 / 255.0 alpha:1];
    self.senNum.textAlignment = NSTextAlignmentCenter;
    self.senNum.font = [UIFont systemFontOfSize:17];
    [self.fenHongView addSubview:_senNum];
    
    UIView *fenGe1 = [[UIView alloc]initWithFrame:CGRectMake(kWidth * 2 / 3 - 0.5, 10, 1, 35)];
    fenGe1.backgroundColor = kViewBackColor;
    [self.fenHongView addSubview:fenGe1];
    
    
    // 三级分红
    self.thirdLabel = [[UILabel alloc]initWithFrame:CGRectMake(kWidth * 2 / 3, 5, kWidth / 3, 20)];
    self.thirdLabel.text = @"三级分红";
    self.thirdLabel.textAlignment = NSTextAlignmentCenter;
    self.thirdLabel.font = [UIFont systemFontOfSize:14];
    self.thirdLabel.textColor = [UIColor grayColor];
    [self.fenHongView addSubview:_thirdLabel];
    // 三级分红 金额
    self.thirdNum = [[UILabel alloc]initWithFrame:CGRectMake(kWidth * 2 / 3, 28, kWidth / 3, 20)];
    //self.thirdNum.text = @"￥0";
    self.thirdNum.textColor = [UIColor colorWithRed:98 / 255.0 green:150 /255.0 blue:194 / 255.0 alpha:1];
    self.thirdNum.textAlignment = NSTextAlignmentCenter;
    self.thirdNum.font = [UIFont systemFontOfSize:17];
    [self.fenHongView addSubview:_thirdNum];
    
    //提现
    self.tiXianView = [[UIView alloc]initWithFrame:CGRectMake(0, 190 + 54, kWidth, 86)];
    self.tiXianView.backgroundColor = [UIColor colorWithRed:248 / 255.0 green:247 / 255.0 blue:247 / 255.0 alpha:1];
    [View addSubview:_tiXianView];
    // 累计收益
    self.leiJiSY = [[UILabel alloc]initWithFrame:CGRectMake(20, 10, 100, 20)];
    // self.leiJiSY.backgroundColor = [UIColor yellowColor];
    self.leiJiSY.text = @"累计收益(元)";
    self.leiJiSY.font = [UIFont systemFontOfSize:14 ];
    self.leiJiSY.textColor = [UIColor grayColor];
    [self.tiXianView addSubview:_leiJiSY];
    // 累计金钱
    self.leiJiMoney = [[UILabel alloc]initWithFrame:CGRectMake(20, 30, 100, 30)];
    //self.leiJiMoney.backgroundColor = [UIColor yellowColor];
    self.leiJiMoney.textColor = [UIColor colorWithRed: 248 / 255.0 green:173/ 255.0 blue:0 alpha:1];
    self.leiJiMoney.font = [UIFont systemFontOfSize:25];
    [self.tiXianView addSubview:_leiJiMoney];
    // 提现收益
    self.tiXianSY = [[UILabel alloc]initWithFrame:CGRectMake(kWidth / 2 + 20, 10, 100, 20)];
    //self.tiXianSY.backgroundColor = [UIColor yellowColor];
    self.tiXianSY.text = @"可提现(元)";
    self.tiXianSY.font = [UIFont systemFontOfSize:14];
    self.tiXianSY.textColor = [UIColor grayColor];
    [self.tiXianView addSubview:_tiXianSY];
    // 提现金钱
    self.tiXianMoney = [[UILabel alloc]initWithFrame:CGRectMake(kWidth / 2 + 20, 30, 100, 30)];
    self.tiXianMoney.textColor = [UIColor colorWithRed: 248 / 255.0 green:173/ 255.0 blue:0 alpha:1];
    self.tiXianMoney.font = [UIFont systemFontOfSize:25];
    [self.tiXianView addSubview:_tiXianMoney];
    
    // 提现按钮
    self.tiXianBt = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.tiXianBt setTitle:@"提现" forState:UIControlStateNormal];
    [self.tiXianBt setTitleColor:[UIColor colorWithRed: 210 / 255.0 green:140/ 255.0 blue:134 / 255.0 alpha:1] forState:UIControlStateNormal];
    [self.tiXianBt addTarget:self action:@selector(tixianAction) forControlEvents:UIControlEventTouchUpInside];
    self.tiXianBt.frame = CGRectMake(kWidth - 60, 60, 45, 18);
    self.tiXianBt.titleLabel.font = [UIFont systemFontOfSize:13];
    self.tiXianBt.layer.masksToBounds = YES;
    self.tiXianBt.layer.cornerRadius = 1;
    self.tiXianBt.layer.borderColor = [UIColor colorWithRed: 210 / 255.0 green:140/ 255.0 blue:134 / 255.0 alpha:1].CGColor;
    self.tiXianBt.layer.borderWidth = 1;
    [self.tiXianView addSubview:_tiXianBt];
    
    // 阅读view
    self.readView = [[UIView alloc]initWithFrame:CGRectMake(0, 330, kWidth, 55)];
    _readView.backgroundColor = [UIColor whiteColor];
    [View addSubview:_readView];
    // 今日阅读
    self.todayRead = [[UILabel alloc]initWithFrame:CGRectMake(0, 10, kWidth / 2, 20)];
    self.todayRead.text = @"今日阅读";
    self.todayRead.textAlignment = NSTextAlignmentCenter;
    self.todayRead.textColor = [UIColor grayColor];
    self.todayRead.font = [UIFont systemFontOfSize:14];
    [self.readView addSubview:_todayRead];
    // 今日阅读 数量
    self.todayNum = [[UILabel alloc]initWithFrame:CGRectMake(0, 30, kWidth / 2, 20)];
    self.todayNum.textAlignment = NSTextAlignmentCenter;
    self.todayNum.font = [UIFont systemFontOfSize:17];
    [self.readView addSubview:_todayNum];
    // 分割线
    UIView *fenGeView = [[UIView alloc]initWithFrame:CGRectMake(kWidth / 2 - 0.5, 10, 1, 35)];
    fenGeView.backgroundColor = [UIColor colorWithRed:248 / 255.0 green:247 / 255.0 blue:247 / 255.0 alpha:1];
    [self.readView addSubview:fenGeView];
    
    // 累计阅读
    self.leiJiRead = [[UILabel alloc]initWithFrame:CGRectMake(kWidth / 2 , 10, kWidth / 2, 20)];
    self.leiJiRead.text = @"累计阅读";
    self.leiJiRead.textAlignment = NSTextAlignmentCenter;
    self.leiJiRead.textColor = [UIColor grayColor];
    self.leiJiRead.font = [UIFont systemFontOfSize:14];
    [self.readView addSubview:_leiJiRead];
    // 累计阅读 数量
    self.leiJiNumber = [[UILabel alloc]initWithFrame:CGRectMake(kWidth / 2 , 30, kWidth / 2, 20)];
    self.leiJiNumber.textAlignment = NSTextAlignmentCenter;
    self.leiJiNumber.font = [UIFont systemFontOfSize:17];
    [self.readView addSubview:_leiJiNumber];
    
}
- (void)notificationKeyboardHeight{
    //增加监听，当键盘出现或改变时收出消息
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
    //增加监听，当键退出时收出消息
    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
}
// 提现点击事件
- (void)tixianAction{
    self.bigView = [[UIView alloc]initWithFrame:self.view.frame];
    _bigView.backgroundColor = [UIColor blackColor];
    _bigView.alpha = 0.4;
    [self.view addSubview:_bigView];
    
    self.TXView = [[UIView alloc]initWithFrame:CGRectMake(15, (kHeight - 120) / 2, kWidth - 30, 120)];
    _TXView.backgroundColor = [UIColor whiteColor];
    _TXView.layer.cornerRadius = 5;
    [self.view addSubview:_TXView];
    
    UILabel *_tixianLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 25, 60, 20)];
    _tixianLabel.text = @"提现金额";
    _tixianLabel.font = [UIFont systemFontOfSize:13];
    _tixianLabel.textColor = [UIColor grayColor];
    [_TXView addSubview:_tixianLabel];
    
    self.textField = [[UITextField  alloc]initWithFrame:CGRectMake(75, 22, kWidth - 145, 26)];
    _textField.borderStyle = UITextBorderStyleRoundedRect;
    _textField.font = [UIFont systemFontOfSize:11];
    _textField.text = [NSString stringWithFormat:@".1f%@",_textField.text];
    _textField.keyboardType = UIKeyboardTypeNumberPad;
    _textField.delegate = self;
    [_TXView addSubview:_textField];
    
    UIButton *allBt = [UIButton buttonWithType:UIButtonTypeCustom];
    allBt.frame = CGRectMake(kWidth - 65, 25, 30, 20);
    [allBt setTitleColor:kAllBtColor forState:UIControlStateNormal];
    allBt.titleLabel.font = [UIFont systemFontOfSize:12];
    [allBt setTitle:@"全部" forState:UIControlStateNormal];
    [allBt addTarget:self action:@selector(allMoney) forControlEvents:UIControlEventTouchUpInside];
    [_TXView addSubview:allBt];
    //
    UIButton *sureBt = [UIButton buttonWithType:UIButtonTypeCustom];
    sureBt.frame = CGRectMake((kWidth- 30) / 2 - 70, 70, 55, 25);
    sureBt.backgroundColor = kAllBtColor;
    [sureBt setTitle:@"确定" forState:UIControlStateNormal];
    [sureBt addTarget:self action:@selector(sureAction) forControlEvents:UIControlEventTouchUpInside];
    sureBt.layer.cornerRadius = 5;
    sureBt.titleLabel.font = [UIFont systemFontOfSize:13];
    [_TXView addSubview:sureBt];
    //取消按钮
    UIButton *cancelBt = [UIButton buttonWithType:UIButtonTypeCustom];
    cancelBt.frame = CGRectMake((kWidth- 30) / 2 + 15, 70, 55, 25);
    cancelBt.backgroundColor = kCancelBtColor;
    [cancelBt setTitle:@"取消" forState:UIControlStateNormal];
    [cancelBt addTarget:self action:@selector(cancelAction) forControlEvents:UIControlEventTouchUpInside];
    cancelBt.layer.cornerRadius = 5;
    cancelBt.titleLabel.font = [UIFont systemFontOfSize:13];
    [_TXView addSubview:cancelBt];
    
}
//当键盘出现或改变时调用

- (void)keyboardWillShow:(NSNotification *)aNotification{
    //获取键盘的高度
    //    NSDictionary *userInfo = [aNotification userInfo];
    //    NSValue *aValue = [userInfo objectForKey:UIKeyboardFrameEndUserInfoKey];
    //    CGRect keyboardRect = [aValue CGRectValue];
    //    int height = keyboardRect.size.height;
    self.TXView.frame = CGRectMake(15, 150, kWidth - 30, 120);
}
//当键退出时调用
- (void)keyboardWillHide:(NSNotification *)aNotification{
    self.TXView.frame = CGRectMake(15, (kHeight - 120) / 2, kWidth - 30, 120);
}
#pragma mark 弹出框上的按钮事件
// 全部
- (void)allMoney{
    self.textField.text = self.moneyLabel.text;
}
// 确定
- (void)sureAction{
    if ([_textField.text floatValue] <= [_tiXianMoney.text floatValue]) {
        NSLog(@"");
    };
}
// 取消
- (void)cancelAction{
    [self.bigView removeFromSuperview];
    [self.TXView removeFromSuperview];
    
}
#pragma mark UITableViewDataSource 和 UITaleViewDelgeate代理方法
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 1;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 3;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    BenefitsTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    if (indexPath.section == 0) {
        cell.title.text = @"倍增收益";
    } else if (indexPath.section == 1){
        cell.title.text = @"赚钱达人榜";
    } else if (indexPath.section == 2){
        cell.title.text = @"常见问题";
    }
    cell.imageV.image = [UIImage imageNamed:@"icon_qt.png"];
    return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.section == 0) {
        
    }else if (indexPath.section == 1){
        self.hidesBottomBarWhenPushed = YES;
        WebViewController *webVC = [[WebViewController alloc] init];
        webVC.webUrl = [NSString stringWithFormat:kYingXiongBangUrl,[kUserDefault objectForKey:@"CFUUID"]];
        [self.navigationController pushViewController:webVC animated:YES];
        self.hidesBottomBarWhenPushed = NO;
    }else if (indexPath.section == 2){
        
    }
}


- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 40;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 2;
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return 0;
}
#pragma  mark UITextFieldDelegate --响应方法
- ( BOOL )textFieldShouldReturn:( UITextField *)textField{
    [_textField resignFirstResponder];
    return  YES;
}
//点击屏幕空白处去掉键盘
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    [self.textField resignFirstResponder];
}


- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
    
    
    if ([textField.text floatValue] >= [_tiXianMoney.text floatValue]) {
        textField.text = _tiXianMoney.text;
    }
    
    return YES;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end
